﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace SuspectPhoto
{
    

    [StructLayout(LayoutKind.Sequential)]  
    public struct GT_DEV_DEVICECFG
    {
        public const int GT_NAME_LEN = 32;
        public const int GT_DEV_SERIALNO_LEN = 48;
        public const int GT_RES_LEN = 43;

        public GT_DEV_DEVICECFG(uint size, string firmwareVersion, uint hardwareID, string devName, string devSerialNo,
            byte devType,byte audioInNum,byte audioOutNum,byte alarmInNum,byte alarmOutNum,byte language,byte[] res )
        {
            Size = size;
            FirmwareVersion = firmwareVersion;
            HardwareID = hardwareID;
            DevName = devName;
            DevSerialNo = devSerialNo;
            DevType = devType;
            AudioInNum = audioInNum;
            AudioOutNum = audioOutNum;
            AlarmInNum = alarmInNum;
            AlarmOutNum = alarmOutNum;
            Language = language;
            Res = res;
        }

        public static GT_DEV_DEVICECFG Init()
        {
            GT_DEV_DEVICECFG r = new GT_DEV_DEVICECFG(0,"",0,"","",0,0,0,0,0,0,new byte[GT_RES_LEN]);

            return r;
        }

        [MarshalAs(UnmanagedType.U4)]
        uint Size;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = GT_NAME_LEN)]
        string FirmwareVersion;

        [MarshalAs(UnmanagedType.U4)]
        uint HardwareID;

        [MarshalAs(UnmanagedType.ByValTStr,SizeConst=GT_NAME_LEN)]
        string				DevName;	// 设备详细型号，字符串格式，可能为空

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = GT_DEV_SERIALNO_LEN)]
        string				DevSerialNo;	// 序列号

        [MarshalAs(UnmanagedType.U1)]
	    byte				DevType;				// 设备类型，见枚举GTDEV_DEVICE_TYPE

        [MarshalAs(UnmanagedType.U1)]
	    byte				AudioInNum;		// 音频口数量

        [MarshalAs(UnmanagedType.U1)]
	    byte				AudioOutNum;		// 音频口数量

        [MarshalAs(UnmanagedType.U1)]
	    byte				AlarmInNum;			// 报警输入口数

        [MarshalAs(UnmanagedType.U1)]
	    byte				AlarmOutNum;			// 报警输出口数

        [MarshalAs(UnmanagedType.U1)]
	    byte				Language;				// 枚举值详见GT_LANGUAGE_TYPE

        [MarshalAs(UnmanagedType.ByValArray, SizeConst = GT_RES_LEN)]
        byte[] Res;				//保留
    }
}
